public class GUO_MING_Q1 {


    private Node head;


    private int n;


    private Node last;

    public GUO_MING_Q1() {
        head = new Node(null, null);
        last = null;
        n = 0;
    }

    public boolean isEmpty() {
        return n == 0;
    }


    public int size() {
        return n;
    }


    public String dequeue() {
        if (isEmpty()) {
            return null;
        }
        Node oldFirst = head.next;
        head.next = head.next.next;
        n--;
        if (isEmpty()) {
            last = null;
        }
        return oldFirst.item;
    }
    public void enqueue(String t) {
        if (last == null) {
            last = new Node(t, null);
            head.next = last;
        } else {
            Node oldLast = last;
            last = new Node(t, null);
            oldLast.next = last;
        }
        n++;
    }

    private class Node {
        public String item;
        public Node next;

        public Node(String item, Node next) {
            this.item = item;
            this.next = next;
        }
    }
}

class Test8 {
    public static void main(String[] args) {
        GUO_MING_Q1 queue = new GUO_MING_Q1();
        System.out.println(queue.size());
        System.out.println(queue.dequeue());
        System.out.println(queue.size());
        System.out.println(queue.isEmpty());
        queue.dequeue();
        queue.dequeue();
        queue.dequeue();
        System.out.println(queue.isEmpty());
        System.out.println(queue.size());
    }
}
